﻿// Profile.cs created with MonoDevelop
// User: jmalcolm at 8:14 P 03/12/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;
using System.Windows.Forms;
using System.Collections.Generic;

namespace ReleaseIt
{
	
	public class Profile
	{
		private string profileName;
		private List<Mask> fileMasks, folderMasks;
		private string sourceDirectory, destinationDirectory;

		public Profile()
		{
			InitializeProfile(DateTime.Now.ToString());
		}
		
		public Profile(string name)
		{
			InitializeProfile(name);
		}

		private void InitializeProfile(string name)
		{
			profileName = name;
			fileMasks = new List<Mask>();
			folderMasks = new List<Mask>();
			sourceDirectory = "";
			destinationDirectory = "";
		}
		
		public List<Mask> FileMasks
		{
			get
			{
				return fileMasks;
			}
		}

		public List<Mask> FolderMasks
		{
			get
			{
				return folderMasks;
			}
		}

		public string Name
		{
			get
			{
				return profileName;
			}
			set
			{
				profileName = value;
			}
		}

		public string SourceDirectory
		{
			get
			{
				return sourceDirectory;
			}
			set
			{
				sourceDirectory = value;
			}
		}

		public string DestinationDirectory
		{
			get
			{
				return destinationDirectory;
			}
			set
			{
				destinationDirectory = value;
			}
		}

		// Populate the list of masks from the GUI
		public void FileMasksFromListBox(CheckedListBox box)
		{
			// Empty list of any current masks
			FileMasks.Clear();
			
			for (int index=0; index < box.Items.Count; index++)
			{
				string mask = box.Items[index].ToString();
				bool selected = box.GetItemChecked(index);

				Mask m = new Mask(mask, selected);

				FileMasks.Add(m);
			}
		}
	}
}
